package com.chorten.cmpp30;

import java.io.ByteArrayOutputStream;

public class Cmpp_Submit extends Cmpp_Base {

	public long Msg_Id = 0;
	public byte Pk_total = 1;
	public byte Pk_number = 1;
	public byte Registered_Delivery;
	public byte Msg_level = 1;
	public String Service_Id;
	public byte Fee_UserType;
	public String Fee_terminal_Id;
	public byte Fee_terminal_type;
	public byte TP_pId;
	public byte TP_udhi;
	public byte Msg_Fmt;
	public String Msg_src;
	public String FeeType;
	public String FeeCode;
	public String ValId_Time;
	public String At_Time;
	public String Src_Id;
	public byte DestUsr_tl;
	public String Dest_terminal_Id;
	public byte Dest_terminal_type;
	public byte Msg_Length;
	public String Msg_Content;
	public String LinkID;

	@Override
	public boolean Decode(byte[] data) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void Encode(ByteArrayOutputStream bs) throws Exception {
		MessageLength = CMPP_HEADER_LENGTH + 151 + DestUsr_tl*32 + (Msg_Length & 0x0FF);
		EncodeHeader(bs);
		Encode(bs, Msg_Id);
		Encode(bs, Pk_total);
		Encode(bs, Pk_number);
		Encode(bs, Registered_Delivery);
		Encode(bs, Msg_level);
		Encode(bs, Service_Id, 10);
		Encode(bs, Fee_UserType);
		Encode(bs, Fee_terminal_Id, 32);
		Encode(bs, Fee_terminal_type);
		Encode(bs, TP_pId);
		Encode(bs, TP_udhi);
		Encode(bs, Msg_Fmt);
		Encode(bs, Msg_src, 6);
		Encode(bs, FeeType, 2);
		Encode(bs, FeeCode, 6);
		Encode(bs, ValId_Time, 17);
		Encode(bs, At_Time, 17);
		Encode(bs, Src_Id, 21);
		Encode(bs, DestUsr_tl);
		Encode(bs, Dest_terminal_Id, 32*DestUsr_tl);
		Encode(bs, Dest_terminal_type);
		Encode(bs, Msg_Length);
		Encode(bs, Msg_Content, Msg_Length & 0x0FF);
		Encode(bs, LinkID, 20);

	}

	public Cmpp_Submit() {
		super();
		Command_id = CMPP_SUBMIT;
		Pk_total = 1;
		Pk_number = 1;
		Registered_Delivery = 0;
		Msg_level = 0;
		TP_pId = 0;
		TP_udhi = 0;
		Fee_UserType = 0;
		FeeType = "01";
		DestUsr_tl = 1;
		ValId_Time = "";
		At_Time = "";
	}

}
